using System;
using System.Collections.Generic;
using System.Text;
using System.Drawing;

namespace Las.WinUI
{
    class GDITextView : SourceGrid.Cells.Views.Cell
    {
        public GDITextView()
        {
            ElementText = new DevAge.Drawing.VisualElements.TextGDI();
        }

        private System.Drawing.StringFormatFlags mFormatFlags = StringFormatFlags.NoWrap;
        public System.Drawing.StringFormatFlags FormatFlags
        {
            get { return mFormatFlags; }
            set { mFormatFlags = value; }
        }

        protected override void PrepareVisualElementText(SourceGrid.CellContext context)
        {
            base.PrepareVisualElementText(context);

            ((DevAge.Drawing.VisualElements.TextGDI)ElementText).StringFormat.FormatFlags = FormatFlags;
        }

        protected override SizeF OnMeasureContent(DevAge.Drawing.MeasureHelper measure, SizeF maxSize)
        {
            //TODO Here I must add some fixed pixels because seems that there are some little
            // difference from the measured content and the actual drawing surface (probably this is a little bug ... I must check)
            SizeF result = base.OnMeasureContent(measure, maxSize);
            return new SizeF(result.Width + 1, result.Height + 1);
        }


    }
}
